<template>
  <div id="case">
    <h2 style="margin-top: 30px">故障案例库</h2>
<!--    <el-form :inline="true"-->
<!--             :model="formInline"-->
<!--             class="demo-form-inline"-->
<!--             style="margin-top: 40px">-->
<!--      <el-form-item label="维护人员">-->
<!--        <el-input v-model="formInline.user" placeholder="请输入名称"></el-input>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="故障设备">-->
<!--        <el-select v-model="formInline.region" placeholder="请选择故障设备">-->
<!--          <el-option label="高压辊磨电机" value="shanghai"></el-option>-->
<!--          <el-option label="辊磨2号变频器控制柜" value="beijing"></el-option>-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item>-->
<!--        <el-button type="primary" @click="onSubmit">查询</el-button>-->
<!--      </el-form-item>-->
<!--    </el-form>-->
<!--    <h3 style="margin-bottom: 30px; margin-top: 20px">查询结果</h3>-->
    <el-card shadow="hover" style="min-height: 600px; margin-top: 15px">
      <el-table :data="tableData" highlight-current-row stripe @row-dblclick="double_click">
        <el-table-column prop="date_time" label="记录时间" min-width="100"></el-table-column>
        <el-table-column prop="phenomenon" label="故障现象记录" min-width="100"></el-table-column>
        <el-table-column prop="cause" label="故障原因记录" min-width="100"></el-table-column>
        <el-table-column prop="result" label="维修采用方法" min-width="100"></el-table-column>
        <el-table-column prop="location" label="故障位置" min-width="100"></el-table-column>
        <el-table-column prop="material" label="所需原料" min-width="100"></el-table-column>
      </el-table>
<!--      <img :src="url">-->
    </el-card>
  </div>



</template>

<script>
import {request} from "../../network/2";
import {request1} from "../../network/1";

export default {
  name: "case",
  data() {
    return {
      formInline: {
        user: '',
        region: ''
      },
      tableData:[],
      url: '',
      imgViewerVisible:false,
      imgList:[
        require('../../assets/1.png')
      ]
    }
  },
  components:{
    'el-image-viewer': () => import('element-ui/packages/image/src/image-viewer')
  },
  created() {
    this.getRes();
    request1('/bb').then((res) => {
      this.url = window.URL.createObjectURL(res.data);//这里请求接收的一定是Blod类型数据
      console.log(this.url);
    })
  },
  methods: {
    onSubmit() {
      console.log('submit!');
    },
    async getRes(){
      let res = await request("/record")
      this.tableData = res.data
      console.log(res);
    },
    double_click(row_data) {
      console.log(row_data);
      this.$store.commit({
        type:"update_res",
        payload:row_data
      });
      this.$router.push({name: 'detail1'})

    }


  }
}
</script>

<style scoped>

</style>